package com.java.crazy.part16;

import com.java.crazy.base.BaseClass;

public class text extends BaseClass {
    public static void main(String[] args) {
        startThreadJoin();
//        startRun();
//        ProcessBuilder processBuilder=new ProcessBuilder();
    }

    public static void startThreadJoin() {
        for (int i = 0; i < 20; i++) {
            logi(Thread.currentThread().getName()+"-"+i);
            if (i == 10) {
                MyThread myThread1 = new MyThread();
                myThread1.start();
                try {
                    myThread1.join();//等待完成再执行
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
                new MyThread().start();
            }
        }
    }

    public static void startRun() {
        MyRunnable myRunnable = new MyRunnable();
        myRunnable.run();
        for (int i = 0; i < 20; i++) {
            logi(Thread.currentThread().getName());
            if (i == 10) {
                new Thread(myRunnable, "Runnable线程1").start();
                new Thread(myRunnable, "Runnable线程2").start();
            }
        }
    }
}
